home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX Base Documentation 1998 November
/
IRIX 6.5.2 Base Documentation November 1998.img
/
usr
/
share
/
catman
/
u_man
/
cat1
/
cksum.z
/
cksum
Wrap
Text File
|
1998-10-20
|
6KB
|
133 lines
CCCCKKKKSSSSUUUUMMMM((((1111)))) CCCCKKKKSSSSUUUUMMMM((((1111))))
NNNNAAAAMMMMEEEE
_cccc_kkkk_ssss_uuuu_mmmm - display file checksums and block counts
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
_cccc_kkkk_ssss_uuuu_mmmm [_----_oooo _1111 | _2222] [_ffff_iiii_llll_eeee _...._...._....]
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
The _cccc_kkkk_ssss_uuuu_mmmm utility writes to the standard output three whitespace
separated fields for each input file. These fields are a checksum _C_R_C,
the total number of octets in the file and the file name. If no file
name is specified, the standard input is used and no file name is
written.
The options are as follows:
----oooo Use historic algorithms instead of the (superior) default one.
Algorithm _1111 is the algorithm used by historic _U_n_i_x systems as the _s_u_m _1
algorithm. This is a 16-bit checksum, with a right rotation before each
addition; overflow is discarded.
Algorithm _2222 is the algorithm used by historic _S_y_s_t_e_m _V _U_n_i_x systems as
the default _s_u_m algorithm. This is a 32-bit checksum, and is defined as
follows:
ssss ==== ssssuuuummmm ooooffff aaaallllllll bbbbyyyytttteeeessss;;;;
rrrr ==== ssss %%%% 2222^^^^11116666 ++++ ((((ssss %%%% 2222^^^^33332222)))) //// 2222^^^^11116666;;;;
cccckkkkssssuuuummmm ==== ((((rrrr %%%% 2222^^^^11116666)))) ++++ rrrr //// 2222^^^^11116666;;;;
Both algorithm _1111 and _2222 write to the standard output the same fields as
the default algorithm except that the size of the file in bytes is
replaced with the size of the file in blocks. For historic reasons, the
block size is 1024 for algorithm _1111 and 512 for algorithm _2222. Partial
blocks are rounded up.
The default _C_R_C used is based on the polynomial used for _C_R_C error
checking in the networking standard -_i_s_o_8_8_0_2-_3. The _C_R_C checksum
encoding is defined by the generating polynomial:
GGGG((((xxxx)))) ==== xxxx^^^^33332222 ++++ xxxx^^^^22226666 ++++ xxxx^^^^22223333 ++++ xxxx^^^^22222222 ++++ xxxx^^^^11116666 ++++ xxxx^^^^11112222 ++++
xxxx^^^^11111111 ++++ xxxx^^^^11110000 ++++ xxxx^^^^8888 ++++ xxxx^^^^7777 ++++ xxxx^^^^5555 ++++ xxxx^^^^4444 ++++ xxxx^^^^2222 ++++ xxxx ++++ 1111
Mathematically, the _C_R_C value corresponding to a given file is defined by
the following procedure:
1111.... The _n bits to be evaluated are considered to be the coefficients of
a mod 2 polynomial M(x) of degree _n-1.
2222.... These _n bits are the bits from the file, with the most significant
bit being the most significant bit of the first octet of the file
and the last bit being the least significant bit of the last octet,
padded with zero bits (if necessary) to achieve an integral number
PPPPaaaaggggeeee 1111
CCCCKKKKSSSSUUUUMMMM((((1111)))) CCCCKKKKSSSSUUUUMMMM((((1111))))
of octets, followed by one or more octets representing the length of
the file as a binary value, least significant octet first.
3333.... The smallest number of octets capable of representing this integer
are used.
4444.... M(x) is multiplied by x^32 (i.e., shifted left 32 bits) and divided
by G(x) using mod 2 division, producing a remainder R(x) of degree
<= 31.
5555.... The coefficients of R(x) are considered to be a 32-bit sequence.
6666.... The bit sequence is complemented and the result is the CRC.
The cccckkkkssssuuuummmm utility exits 0 on success, and >0 if an error occurs.
SSSSEEEEEEEE AAAALLLLSSSSOOOO
The default calculation is identical to that given in pseudo-code in the
following _A_C_M article.
_T_i_t_l_e: CCCCoooommmmppppuuuuttttaaaattttiiiioooonnnn ooooffff CCCCyyyycccclllliiiicccc RRRReeeedddduuuunnnnddddaaaannnnccccyyyy CCCChhhheeeecccckkkkssss VVVViiiiaaaa TTTTaaaabbbblllleeee LLLLooooooookkkkuuuupppp
_A_u_t_h_o_r: DDDDiiiilllliiiipppp VVVV.... SSSSaaaarrrrwwwwaaaatttteeee
_P_u_b_l_i_c_a_t_i_o_n: CCCCoooommmmmmmmuuuunnnniiiiccccaaaattttiiiioooonnnnssss ooooffff tttthhhheeee AAAACCCCMMMM;;;; AAAAuuuugggguuuusssstttt 1111999988888888
SSSSTTTTAAAANNNNDDDDAAAARRRRDDDDSSSS
The cccckkkkssssuuuummmm utility is expected to be POSIX 1003.2 compatible.
HHHHIIIISSSSTTTTOOOORRRRYYYY
The cccckkkkssssuuuummmm utility appears in _B_S_D _4._4 .
PPPPaaaaggggeeee 2222